package com.hqd.ch03.v50.boot;

import com.hqd.ch03.v50.context.ApplicationEvent;
import com.hqd.ch03.v50.context.ConfigurableApplicationContext;

public class BootstrapContextClosedEvent extends ApplicationEvent {

    private final ConfigurableApplicationContext applicationContext;

    BootstrapContextClosedEvent(BootstrapContext source, ConfigurableApplicationContext applicationContext) {
        super(source);
        this.applicationContext = applicationContext;
    }

    /**
     * Return the {@link BootstrapContext} that was closed.
     *
     * @return the bootstrap context
     */
    public BootstrapContext getBootstrapContext() {
        return (BootstrapContext) this.source;
    }

    /**
     * Return the prepared application context.
     *
     * @return the application context
     */
    public ConfigurableApplicationContext getApplicationContext() {
        return this.applicationContext;
    }

}
